package comWorld.action.msg;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import comWorld.msg.MessageManage;
import comWorld.user.UserInfo;

/**
 * Servlet implementation class DeleteAllMsgs
 */
@WebServlet("/action/msg/deleteAllMsgs")
public class DeleteAllMsgs extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public DeleteAllMsgs() {
        super();
    }

	/**
	 * @see HttpServlet#service(HttpServletRequest request, HttpServletResponse response)
	 */
	public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		UserInfo visitorInfo = (UserInfo) request.getSession().getAttribute("visitorInfo");
		String otherIdStr = request.getParameter("otherId");
		int otherId = (otherIdStr == null ? 0 : Integer.valueOf(otherIdStr));
		
		MessageManage.deleteAllMsgs(visitorInfo.getId(), otherId);
	}

}
